﻿@using System.Data
@using System.Text.RegularExpressions
@using ZoomLa.BLL
@using ZoomLa.Model
@using ZoomLa.Common
@model ZoomLa.Model.M_Exam_Sys_Questions
@{
    B_Exam_Sys_Questions questionBll = new B_Exam_Sys_Questions();
    B_Questions_Knowledge knowBll = new B_Questions_Knowledge();
    string AngularJS = "";
    DataTable questDt = (DataTable)ViewBag.questDt;
}
@functions{
}
@section head{
<title>试题预览</title>
<style>
#options p { display: inline-block; }
ul { padding-left: 20px; }
</style>
<script src="/JS/Plugs/angular.min.js"></script>  
}
@section content{
<div id="BreadDiv" class="container-fluid mysite">
    <div class="row">
        <ol id="BreadNav" class="breadcrumb navbar-fixed-top">
            <li><a href='@CustomerPageAction.customPath2/I/Main.aspx'>工作台</a></li>
            <li><a href='Papers_System_Manage'>教育模块</a></li>
            <li><a href='QuestionManage'>试题管理</a></li>
            <li>试题预览</li>
        </ol>
    </div>
</div>
<div>
    <table class="table table-striped table-bordered table-hover" ng-app="app">
        <tr>
            <td class="td_l">试题标题:</td>
            <td>@Model.p_title</td>
        </tr>
        <tr>
            <td>所属年级:</td>
            <td>@B_GradeOption.GetGradeOption(Model.p_Views).GradeName</td>
        </tr>
        <tr>
            <td>难度:</td>
            <td>@questionBll.GetDiffStr(Model.p_Difficulty)</td>
        </tr>
        <tr>
            <td>题型:</td>
            <td>@M_Exam_Sys_Questions.GetTypeStr(Model.p_Type)</td>
        </tr>
        <tr>
            <td>知识点:</td>
            <td>@(string.IsNullOrEmpty(Model.Tagkey) ? "" : knowBll.GetNamesByIDS(Model.Tagkey))</td>
        </tr>
        <tr>
            <td>试题内容:</td>
            <td>
                @MvcHtmlString.Create(Model.LargeContent)
            </td>
        </tr>
        <tr>
            <td>分数:</td>
            <td>@Model.p_defaultScores</td>
        </tr>
        <tr>
            <td>试题选项数:</td>
            <td>@Model.p_ChoseNum</td>
        </tr>
        <tr>
            <td>选项预览:</td>
            <td id="options" ng-controller="appController">
                <ul>
                    @if (Model.p_Type != 10)
                    {
                        @MvcHtmlString.Create(questionBll.GetSubmit(Model.p_id, Model.p_Type, ref AngularJS))
                    }
                    else
                    {
                        foreach (DataRow dr in questDt.Rows)
                        {
                            <div class="content" style="margin-top:10px;">
                                <span>@(questDt.Rows.IndexOf(dr)+1)．@dr["P_Title"]></span>@questionBll.GetContent(DataConverter.CLng(dr["p_id"]), DataConverter.CLng(dr["p_type"]),dr["p_Content"].ToString())
                            </div>
                            <div class="submit">
                                <ul class="submitul">
                                    @questionBll.GetSubmit(DataConverter.CLng(dr["p_id"]), DataConverter.CLng(dr["p_type"]), ref AngularJS)
                                </ul>
                                <div class="clearfix"></div>
                            </div>
                            <div>正确答案:@dr["p_Answer"]</div>
                        }
                    }
                </ul>
            </td>
        </tr>
        <tr>
            <td>正确答案(仅用于自动改卷):</td>
            <td>@Model.p_Answer</td>
        </tr>
        <tr>
            <td>正确答案(教师与学生可见):</td>
            <td>
                @MvcHtmlString.Create(Model.p_shuming)
        </td>
    </tr>
    <tr>
        <td>试题解析:</td>
        <td>
            @MvcHtmlString.Create(Model.Jiexi)
    </td>
</tr>
</table>
<div class="text-center">
    <a href="AddEngLishQuestion?id=@Request.QueryString["id"]" class="btn btn-primary">重新修改</a>
    <a href="@Url.Action("QuestList","Exam")" class="btn btn-primary">返回列表</a>
</div>
</div>
<input type="hidden" id="answer_hid" />
}
@section script{
<script>
        var page={scope:null,addModel:function(name,model){
            page.scope.list[name]=model;
        }};
        var app=angular.module("app",[]).controller("appController",function($scope,$compile){
            page.scope=$scope;
            $scope.list={};
            var idsArr=[];//仅用于显示答案
            //<%=AngularJS%>

            });
        app.filter(
             'to_trusted', ['$sce', function ($sce) {
                 return function (text) {
                     return $sce.trustAsHtml(text);
                 }
             }]
         );
</script> 
}